package com.zufangbao.earth.web.controller.system;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.demo2do.core.web.interceptor.MenuSetting;
import com.zufangbao.sun.entity.Channel;
import com.zufangbao.sun.entity.company.corp.AppAccount;
import com.zufangbao.sun.service.AppAccountService;
import com.zufangbao.sun.service.DirectBankConnectService;

@Controller
@RequestMapping("/directbank")
@MenuSetting("menu-system")
public class DirectbankController {
  
  @Autowired
  private DirectBankConnectService directBankConnectService;
  @Autowired
  private AppAccountService appAccountService;
  

  @RequestMapping("")
  @MenuSetting("submenu-directbank")
  public ModelAndView listConfig(){
    ModelAndView modelAndView = new ModelAndView("config/directbank/directbank-config");
    
    Map<String, Object> configParams  = directBankConnectService.getConfigParams();
    
    List<AppAccount> appAccountList = appAccountService.getAppAccountsByChannel(Channel.DIRECTBANK);
    
    modelAndView.addObject("appAccountList", appAccountList);
    modelAndView.addObject("configParams", configParams);
    return modelAndView;
  }
}
